package com.zndroid.notification;

import android.content.Context;

import com.zndroid.notification.box.Trumpet;
import com.zndroid.notification.policy.Delegate;

/**
 * 本地通知API入口
 * @author lzy
 * @date 2021/2/8
 */
public final class Notifier {
    private static Context applicationContext;
    private Trumpet trumpet;
    private Delegate delegate;

    private Notifier(){}
    private static class Self {
        private static final Notifier OWNER = new Notifier();
    }

    public static Notifier with(Context context) {
        if (null == context) {
            throw new IllegalArgumentException("You cannot start a load on a null Context");
        }
        applicationContext = context.getApplicationContext();
        return Self.OWNER;
    }

    public Notifier holdTrumpet(Trumpet trumpet) {
        this.trumpet = trumpet;
        return this;
    }

    public void show() {
        delegate = new Delegate(applicationContext, trumpet);
        delegate.show();
    }
}
